package run.bottle.gof23.factory;

import junit.framework.TestCase;
import run.bottle.gof23.factory.abstractf.HuaWeiFactory;
import run.bottle.gof23.factory.abstractf.PhoneProduct;
import run.bottle.gof23.factory.abstractf.RouterProduct;
import run.bottle.gof23.factory.abstractf.XiaomiFactory;

public class Client  extends TestCase {

    public void testRun() {
        System.out.println("===========小米系列产品===========");
        //小米工厂
        XiaomiFactory xiaomiFactory = new XiaomiFactory();
        PhoneProduct phoneProduct = xiaomiFactory.phoneProduct();
        phoneProduct.start();
        phoneProduct.sendSms();
        phoneProduct.shutdown();

        RouterProduct routerProduct = xiaomiFactory.routerProduct();
        routerProduct.start();
        routerProduct.openWifi();

        System.out.println("===========华为系列产品===========");
        //华为工厂
        HuaWeiFactory huaweiFactory = new HuaWeiFactory();
        phoneProduct = huaweiFactory.phoneProduct();
        phoneProduct.start();
        phoneProduct.sendSms();
        phoneProduct.shutdown();

        routerProduct = huaweiFactory.routerProduct();
        routerProduct.start();
        routerProduct.openWifi();
    }

}
